home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / vidbasic.zip / VFADE.ASM < prev    next >
Assembly Source File  |  1990-11-29  |  4KB  |  109 lines

  1. ;«RM82»«TS8,16,24,32,40,48,56,64»
  2. ; Updated 11/20/90
  3.  
  4. ;============================================================================
  5. ;   Copyright (C) Copr. 1990 by Sidney J. Kelly
  6. ;           All Rights Reserved.
  7. ;           Sidney J. Kelly
  8. ;           150 Woodhaven Drive
  9. ;           Pittsburgh, PA 15228
  10. ;           home phone 412-561-0950 (7pm to 9:30pm EST)
  11. ;============================================================================
  12.  
  13. DOSSEG
  14. .model medium, Basic
  15.  
  16. .data
  17.     ;external data so all video routines can access
  18.     EVEN
  19.     EXTRN    B$DVIDEOSEG:WORD
  20.     EXTRN   B$DVIDEOINSTL:BYTE
  21. .code
  22.  
  23. INCLUDE  NOWAIT.INC
  24. EXTRN   Get_Adapter:FAR
  25.  
  26. EVEN
  27. Page_Size       DW      0       ; store size of display in words
  28. Num_Times       DB      0       ; store loop counter
  29.  
  30. ;============================================================================
  31. ; DECLARE SUB FADE ()
  32. ; CALL FADE
  33. ; Purpose: Clever visual effect, fades out display to white on black.
  34. ; Changes all characters to spaces.
  35. ; Works in TextMode only.  Sensitive to all video modes (i.e. no snow on CGA's)
  36. ; Assumes: Display width is 80 * 25, 80 * 43 or 80 * 50
  37. ;============================================================================
  38.  
  39. EVEN
  40. FADE Proc FAR BASIC USES SI DI DS
  41.     Mov   Num_Times,12      ; loop counter (go through loop 12 times)
  42.                 ; which is (255-32) / 19
  43.     Cmp   B$DVIDEOINSTL,1   ; See if we have done this before
  44.     JE    Didit             ; yep, so skip ahead
  45.     Call  Get_Adapter       ; call routine to find display type
  46.  
  47. Didit:
  48.                 ; determine video page size
  49.                 ; do it the hard way because of error
  50.                 ; in certain HERC clones
  51.     Xor   AX,AX             ; clear AX
  52.     Mov   ES,AX             ; set ES to BIOS ram
  53.     Xor   BH,BH             ; clear high byte
  54.     Mov   BL,Byte Ptr ES:[0484h]  ; read ROW from BIOS ram
  55.     Or    BL,BL             ; is ROW 0? (i.e. is this CGA, HERC or MONO?)
  56.     JNZ   @f                ; nope, it is a EGA, MCGA or VGA
  57.     Mov   BL,24             ; set default ROW to 24
  58. @@:
  59.     Inc   BL                ; remove 0 bias of ROW
  60.     Mov   AX,ES:[044Ah]     ; read COLUMN from BIOS ram
  61.     Mul   BX                ; multiply ROW times COLUMN
  62.     Mov   CS:[Page_Size],AX ; store Page_Size in memory
  63.     Mov   AX,B$DVIDEOSEG    ; get default video segment
  64.     Mov   ES,AX             ; store in ES
  65.     Mov   DS,AX             ; store in DS too
  66.     Mov   DX,03DAh          ; assume color retrace port
  67.     Cmp   AX,0B800h         ; is it a Color display?
  68.     JE    @f                ; yes, so jump ahead
  69.     Mov   DX,03BAh          ; else, retrace port for mono display
  70. @@:
  71.     Cld                     ; clear the direction flag
  72.                 ; to move data forward
  73. EVEN                            ; speed up loops on AT's and above
  74. Main_Loop:
  75.     Xor   DI,DI             ; start at Row 0, Col 0
  76.     Mov   SI,DI             ; (1 clock faster than XOR)
  77.     Mov   CX,CS:[Page_Size] ; number of bytes to change
  78.     Mov   AH,7              ; make attribute white on black
  79. EVEN
  80. Disp_Loop:
  81.     CLI                     ; prevent interrupts to speed routine
  82.     Wait_CGA_Retrace        ; wait for retrace on CGA MACRO
  83.     Lodsb                   ; get character from DS:SI and increment SI
  84.     STI                     ; this prevents snow on CGA
  85.     Sub   AL,19             ; subtrace 19 from character each loop
  86.     Cmp   AL,32             ; don't let it drop below 32, ASCII space
  87.     JAE   @f
  88.     Mov   AL,32             ; if below 32, make it 32
  89. @@:
  90.     Mov   BX,AX             ; store AX in BX since retrace
  91.     CLI                     ; macro destroys AX
  92.     Wait_CGA_Retrace        ; wait for retrace on CGA MACRO
  93.     Xchg  AL,BL        ; one less byte than Mov AL,BL
  94.     Stosw                   ; store character & attribute at ES:DI
  95.     STI                     ; allow interrupts again
  96.     ;Call  NEAR PTR Delay    ; waste time
  97.     Inc   SI                ; skip over attribute to next cell
  98.     Loop  Disp_Loop         ; loop until CX is zero
  99.  
  100. Exit:
  101.     Dec   Num_Times         ; have we done it 12 times?
  102.     Jz    Finis             ; yep, so end
  103.     Jmp   Short  Main_Loop
  104. EVEN
  105. Finis:
  106.     Ret                     ; return
  107. FADE    Endp
  108. END
  109.